﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Client.aspx.cs" Inherits="LadyBugWeb.Page.Client" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Client</h1>
    <p>
        <asp:Button ID="btn_Clients" runat="server" Text="Show Clients" Width="100px" 
            onclick="btn_Clients_Click" />
&nbsp;
        <asp:Button ID="btn_ClientDetail" runat="server" Text="Client Detail" 
            Width="100px" onclick="btn_ClientDetail_Click" />
&nbsp;
        <asp:Button ID="Button5" runat="server" Text="Button" Width="100px" />
    </p>
        <asp:MultiView ID="MultiView1" runat="server">
            <asp:View ID="View1" runat="server">
                <h3>Client - List </h3>
                <br />
                <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="pat_id" DataSourceID="SqlDataSource1" 
                    EmptyDataText="No data to display." BackColor="White" 
                    BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                    GridLines="Horizontal" Height="126px" 
                    style="text-align: center" Width="900px">
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <Columns>
                        <asp:BoundField DataField="pat_salutation" HeaderText="Salut" 
                            SortExpression="pat_salutation" />
                        <asp:BoundField DataField="pat_firstName" HeaderText="First Name" 
                            SortExpression="pat_firstName" />
                        <asp:BoundField DataField="pat_lastName" HeaderText="Last Name" 
                            SortExpression="pat_lastName" />
                        <asp:BoundField DataField="pat_langSpoken" HeaderText="language" 
                            SortExpression="pat_langSpoken" />
                        <asp:BoundField DataField="pat_DOB" HeaderText="DOB" 
                            SortExpression="pat_DOB" Visible="False" />
                        <asp:TemplateField ShowHeader="False">
                            <ItemTemplate>
                                <asp:Button ID="btn_EditClient" runat="server" onclick="btn_EditClient_Click" 
                                    Text="Edit" Width="35px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <SortedAscendingCellStyle BackColor="#F4F4FD" />
                    <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
                    <SortedDescendingCellStyle BackColor="#D8D8F0" />
                    <SortedDescendingHeaderStyle BackColor="#3E3277" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:LadyBugDBConnectionString1 %>" 
                    DeleteCommand="DELETE FROM [tblPatient] WHERE [pat_id] = @pat_id" 
                    InsertCommand="INSERT INTO [tblPatient] ([pat_id], [pat_firstName], [pat_lastName], [pat_OHIP], [pat_DOB], [pat_gender], [pat_langSpoken], [pat_salutation], [pat_city1], [pat_street1], [pat_postalCode1], [pat_province1], [pat_city2], [pat_street2], [pat_postalCode2], [pat_province2]) VALUES (@pat_id, @pat_firstName, @pat_lastName, @pat_OHIP, @pat_DOB, @pat_gender, @pat_langSpoken, @pat_salutation, @pat_city1, @pat_street1, @pat_postalCode1, @pat_province1, @pat_city2, @pat_street2, @pat_postalCode2, @pat_province2)" 
                    ProviderName="<%$ ConnectionStrings:LadyBugDBConnectionString1.ProviderName %>" 
                    SelectCommand="SELECT [pat_id], [pat_firstName], [pat_lastName], [pat_OHIP], [pat_DOB], [pat_gender], [pat_langSpoken], [pat_salutation], [pat_city1], [pat_street1], [pat_postalCode1], [pat_province1], [pat_city2], [pat_street2], [pat_postalCode2], [pat_province2] FROM [tblPatient]" 
                    UpdateCommand="UPDATE [tblPatient] SET [pat_firstName] = @pat_firstName, [pat_lastName] = @pat_lastName, [pat_OHIP] = @pat_OHIP, [pat_DOB] = @pat_DOB, [pat_gender] = @pat_gender, [pat_langSpoken] = @pat_langSpoken, [pat_salutation] = @pat_salutation, [pat_city1] = @pat_city1, [pat_street1] = @pat_street1, [pat_postalCode1] = @pat_postalCode1, [pat_province1] = @pat_province1, [pat_city2] = @pat_city2, [pat_street2] = @pat_street2, [pat_postalCode2] = @pat_postalCode2, [pat_province2] = @pat_province2 WHERE [pat_id] = @pat_id">
                    <DeleteParameters>
                        <asp:Parameter Name="pat_id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="pat_id" Type="Int32" />
                        <asp:Parameter Name="pat_firstName" Type="String" />
                        <asp:Parameter Name="pat_lastName" Type="String" />
                        <asp:Parameter Name="pat_OHIP" Type="String" />
                        <asp:Parameter Name="pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="pat_gender" Type="String" />
                        <asp:Parameter Name="pat_langSpoken" Type="String" />
                        <asp:Parameter Name="pat_salutation" Type="String" />
                        <asp:Parameter Name="pat_city1" Type="String" />
                        <asp:Parameter Name="pat_street1" Type="String" />
                        <asp:Parameter Name="pat_postalCode1" Type="String" />
                        <asp:Parameter Name="pat_province1" Type="String" />
                        <asp:Parameter Name="pat_city2" Type="String" />
                        <asp:Parameter Name="pat_street2" Type="String" />
                        <asp:Parameter Name="pat_postalCode2" Type="String" />
                        <asp:Parameter Name="pat_province2" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="pat_firstName" Type="String" />
                        <asp:Parameter Name="pat_lastName" Type="String" />
                        <asp:Parameter Name="pat_OHIP" Type="String" />
                        <asp:Parameter Name="pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="pat_gender" Type="String" />
                        <asp:Parameter Name="pat_langSpoken" Type="String" />
                        <asp:Parameter Name="pat_salutation" Type="String" />
                        <asp:Parameter Name="pat_city1" Type="String" />
                        <asp:Parameter Name="pat_street1" Type="String" />
                        <asp:Parameter Name="pat_postalCode1" Type="String" />
                        <asp:Parameter Name="pat_province1" Type="String" />
                        <asp:Parameter Name="pat_city2" Type="String" />
                        <asp:Parameter Name="pat_street2" Type="String" />
                        <asp:Parameter Name="pat_postalCode2" Type="String" />
                        <asp:Parameter Name="pat_province2" Type="String" />
                        <asp:Parameter Name="pat_id" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <h3>
                    Client Details
                </h3>
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                    BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="3" DataKeyNames="pat_id" DataSourceID="ClientDetails" 
                    GridLines="Horizontal" Height="48px" Width="468px">
                    <AlternatingRowStyle BackColor="#F7F7F7" />
                    <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <Fields>
                        <asp:BoundField DataField="pat_id" HeaderText="ID" ReadOnly="True" 
                            SortExpression="pat_id" />
                        <asp:BoundField DataField="pat_firstName" HeaderText="First Name" 
                            SortExpression="pat_firstName" />
                        <asp:BoundField DataField="pat_lastName" HeaderText="Last Name" 
                            SortExpression="pat_lastName" />
                        <asp:BoundField DataField="pat_OHIP" HeaderText="OHIP" 
                            SortExpression="pat_OHIP" />
                        <asp:BoundField DataField="pat_DOB" HeaderText="DOB" SortExpression="pat_DOB" />
                        <asp:BoundField DataField="pat_gender" HeaderText="gender" 
                            SortExpression="pat_gender" />
                        <asp:BoundField DataField="pat_langSpoken" HeaderText="Spoken" 
                            SortExpression="pat_langSpoken" />
                        <asp:BoundField DataField="pat_salutation" HeaderText="salutation" 
                            SortExpression="pat_salutation" />
                        <asp:BoundField DataField="pat_city1" HeaderText="City 1" 
                            SortExpression="pat_city1" />
                        <asp:BoundField DataField="pat_street1" HeaderText="Street 1" 
                            SortExpression="pat_street1" />
                        <asp:BoundField DataField="pat_postalCode1" HeaderText="Postal Code 1" 
                            SortExpression="pat_postalCode1" />
                        <asp:BoundField DataField="pat_province1" HeaderText="Province 1" 
                            SortExpression="pat_province1" />
                        <asp:BoundField DataField="pat_city2" HeaderText="City 2" 
                            SortExpression="pat_city2" />
                        <asp:BoundField DataField="pat_street2" HeaderText="Street 2" 
                            SortExpression="pat_street2" />
                        <asp:BoundField DataField="pat_postalCode2" HeaderText="Postal Code 2" 
                            SortExpression="pat_postalCode2" />
                        <asp:BoundField DataField="pat_province2" HeaderText="Province 2" 
                            SortExpression="pat_province2" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                            ShowInsertButton="True" />
                    </Fields>
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                    <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                </asp:DetailsView>
                <asp:SqlDataSource ID="ClientDetails" runat="server" 
                    ConflictDetection="CompareAllValues" 
                    ConnectionString="<%$ ConnectionStrings:LadyBugDBConnectionString1 %>" 
                    DeleteCommand="DELETE FROM [tblPatient] WHERE [pat_id] = @original_pat_id AND [pat_firstName] = @original_pat_firstName AND [pat_lastName] = @original_pat_lastName AND (([pat_OHIP] = @original_pat_OHIP) OR ([pat_OHIP] IS NULL AND @original_pat_OHIP IS NULL)) AND (([pat_DOB] = @original_pat_DOB) OR ([pat_DOB] IS NULL AND @original_pat_DOB IS NULL)) AND (([pat_gender] = @original_pat_gender) OR ([pat_gender] IS NULL AND @original_pat_gender IS NULL)) AND (([pat_langSpoken] = @original_pat_langSpoken) OR ([pat_langSpoken] IS NULL AND @original_pat_langSpoken IS NULL)) AND (([pat_salutation] = @original_pat_salutation) OR ([pat_salutation] IS NULL AND @original_pat_salutation IS NULL)) AND (([pat_city1] = @original_pat_city1) OR ([pat_city1] IS NULL AND @original_pat_city1 IS NULL)) AND (([pat_street1] = @original_pat_street1) OR ([pat_street1] IS NULL AND @original_pat_street1 IS NULL)) AND (([pat_postalCode1] = @original_pat_postalCode1) OR ([pat_postalCode1] IS NULL AND @original_pat_postalCode1 IS NULL)) AND (([pat_province1] = @original_pat_province1) OR ([pat_province1] IS NULL AND @original_pat_province1 IS NULL)) AND (([pat_city2] = @original_pat_city2) OR ([pat_city2] IS NULL AND @original_pat_city2 IS NULL)) AND (([pat_street2] = @original_pat_street2) OR ([pat_street2] IS NULL AND @original_pat_street2 IS NULL)) AND (([pat_postalCode2] = @original_pat_postalCode2) OR ([pat_postalCode2] IS NULL AND @original_pat_postalCode2 IS NULL)) AND (([pat_province2] = @original_pat_province2) OR ([pat_province2] IS NULL AND @original_pat_province2 IS NULL))" 
                    InsertCommand="INSERT INTO [tblPatient] ([pat_id], [pat_firstName], [pat_lastName], [pat_OHIP], [pat_DOB], [pat_gender], [pat_langSpoken], [pat_salutation], [pat_city1], [pat_street1], [pat_postalCode1], [pat_province1], [pat_city2], [pat_street2], [pat_postalCode2], [pat_province2]) VALUES (@pat_id, @pat_firstName, @pat_lastName, @pat_OHIP, @pat_DOB, @pat_gender, @pat_langSpoken, @pat_salutation, @pat_city1, @pat_street1, @pat_postalCode1, @pat_province1, @pat_city2, @pat_street2, @pat_postalCode2, @pat_province2)" 
                    OldValuesParameterFormatString="original_{0}" 
                    SelectCommand="SELECT * FROM [tblPatient] WHERE ([pat_id] = @pat_id)" 
                    UpdateCommand="UPDATE [tblPatient] SET [pat_firstName] = @pat_firstName, [pat_lastName] = @pat_lastName, [pat_OHIP] = @pat_OHIP, [pat_DOB] = @pat_DOB, [pat_gender] = @pat_gender, [pat_langSpoken] = @pat_langSpoken, [pat_salutation] = @pat_salutation, [pat_city1] = @pat_city1, [pat_street1] = @pat_street1, [pat_postalCode1] = @pat_postalCode1, [pat_province1] = @pat_province1, [pat_city2] = @pat_city2, [pat_street2] = @pat_street2, [pat_postalCode2] = @pat_postalCode2, [pat_province2] = @pat_province2 WHERE [pat_id] = @original_pat_id AND [pat_firstName] = @original_pat_firstName AND [pat_lastName] = @original_pat_lastName AND (([pat_OHIP] = @original_pat_OHIP) OR ([pat_OHIP] IS NULL AND @original_pat_OHIP IS NULL)) AND (([pat_DOB] = @original_pat_DOB) OR ([pat_DOB] IS NULL AND @original_pat_DOB IS NULL)) AND (([pat_gender] = @original_pat_gender) OR ([pat_gender] IS NULL AND @original_pat_gender IS NULL)) AND (([pat_langSpoken] = @original_pat_langSpoken) OR ([pat_langSpoken] IS NULL AND @original_pat_langSpoken IS NULL)) AND (([pat_salutation] = @original_pat_salutation) OR ([pat_salutation] IS NULL AND @original_pat_salutation IS NULL)) AND (([pat_city1] = @original_pat_city1) OR ([pat_city1] IS NULL AND @original_pat_city1 IS NULL)) AND (([pat_street1] = @original_pat_street1) OR ([pat_street1] IS NULL AND @original_pat_street1 IS NULL)) AND (([pat_postalCode1] = @original_pat_postalCode1) OR ([pat_postalCode1] IS NULL AND @original_pat_postalCode1 IS NULL)) AND (([pat_province1] = @original_pat_province1) OR ([pat_province1] IS NULL AND @original_pat_province1 IS NULL)) AND (([pat_city2] = @original_pat_city2) OR ([pat_city2] IS NULL AND @original_pat_city2 IS NULL)) AND (([pat_street2] = @original_pat_street2) OR ([pat_street2] IS NULL AND @original_pat_street2 IS NULL)) AND (([pat_postalCode2] = @original_pat_postalCode2) OR ([pat_postalCode2] IS NULL AND @original_pat_postalCode2 IS NULL)) AND (([pat_province2] = @original_pat_province2) OR ([pat_province2] IS NULL AND @original_pat_province2 IS NULL))">
                    <DeleteParameters>
                        <asp:Parameter Name="original_pat_id" Type="Int32" />
                        <asp:Parameter Name="original_pat_firstName" Type="String" />
                        <asp:Parameter Name="original_pat_lastName" Type="String" />
                        <asp:Parameter Name="original_pat_OHIP" Type="String" />
                        <asp:Parameter Name="original_pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="original_pat_gender" Type="String" />
                        <asp:Parameter Name="original_pat_langSpoken" Type="String" />
                        <asp:Parameter Name="original_pat_salutation" Type="String" />
                        <asp:Parameter Name="original_pat_city1" Type="String" />
                        <asp:Parameter Name="original_pat_street1" Type="String" />
                        <asp:Parameter Name="original_pat_postalCode1" Type="String" />
                        <asp:Parameter Name="original_pat_province1" Type="String" />
                        <asp:Parameter Name="original_pat_city2" Type="String" />
                        <asp:Parameter Name="original_pat_street2" Type="String" />
                        <asp:Parameter Name="original_pat_postalCode2" Type="String" />
                        <asp:Parameter Name="original_pat_province2" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="pat_id" Type="Int32" />
                        <asp:Parameter Name="pat_firstName" Type="String" />
                        <asp:Parameter Name="pat_lastName" Type="String" />
                        <asp:Parameter Name="pat_OHIP" Type="String" />
                        <asp:Parameter Name="pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="pat_gender" Type="String" />
                        <asp:Parameter Name="pat_langSpoken" Type="String" />
                        <asp:Parameter Name="pat_salutation" Type="String" />
                        <asp:Parameter Name="pat_city1" Type="String" />
                        <asp:Parameter Name="pat_street1" Type="String" />
                        <asp:Parameter Name="pat_postalCode1" Type="String" />
                        <asp:Parameter Name="pat_province1" Type="String" />
                        <asp:Parameter Name="pat_city2" Type="String" />
                        <asp:Parameter Name="pat_street2" Type="String" />
                        <asp:Parameter Name="pat_postalCode2" Type="String" />
                        <asp:Parameter Name="pat_province2" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="GridView3" DefaultValue="0" Name="pat_id" 
                            PropertyName="SelectedValue" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="pat_firstName" Type="String" />
                        <asp:Parameter Name="pat_lastName" Type="String" />
                        <asp:Parameter Name="pat_OHIP" Type="String" />
                        <asp:Parameter Name="pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="pat_gender" Type="String" />
                        <asp:Parameter Name="pat_langSpoken" Type="String" />
                        <asp:Parameter Name="pat_salutation" Type="String" />
                        <asp:Parameter Name="pat_city1" Type="String" />
                        <asp:Parameter Name="pat_street1" Type="String" />
                        <asp:Parameter Name="pat_postalCode1" Type="String" />
                        <asp:Parameter Name="pat_province1" Type="String" />
                        <asp:Parameter Name="pat_city2" Type="String" />
                        <asp:Parameter Name="pat_street2" Type="String" />
                        <asp:Parameter Name="pat_postalCode2" Type="String" />
                        <asp:Parameter Name="pat_province2" Type="String" />
                        <asp:Parameter Name="original_pat_id" Type="Int32" />
                        <asp:Parameter Name="original_pat_firstName" Type="String" />
                        <asp:Parameter Name="original_pat_lastName" Type="String" />
                        <asp:Parameter Name="original_pat_OHIP" Type="String" />
                        <asp:Parameter Name="original_pat_DOB" Type="DateTime" />
                        <asp:Parameter Name="original_pat_gender" Type="String" />
                        <asp:Parameter Name="original_pat_langSpoken" Type="String" />
                        <asp:Parameter Name="original_pat_salutation" Type="String" />
                        <asp:Parameter Name="original_pat_city1" Type="String" />
                        <asp:Parameter Name="original_pat_street1" Type="String" />
                        <asp:Parameter Name="original_pat_postalCode1" Type="String" />
                        <asp:Parameter Name="original_pat_province1" Type="String" />
                        <asp:Parameter Name="original_pat_city2" Type="String" />
                        <asp:Parameter Name="original_pat_street2" Type="String" />
                        <asp:Parameter Name="original_pat_postalCode2" Type="String" />
                        <asp:Parameter Name="original_pat_province2" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </asp:View>
            <asp:View ID="View2" runat="server">
                <br />
            </asp:View>
            <asp:View ID="View3" runat="server">
                 <h3>Client Orders</h3>
                <br />
            </asp:View>
            <asp:View ID="View4" runat="server">
                 <h3>Client Order Details</h3>
                 <br />
            </asp:View>
        </asp:MultiView>
</asp:Content>
